#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define maxn 10000
const int baselen = 500;
int p;
int a[maxn], b[maxn], t[maxn];
void multiply(int x[], int y[])
{
    memset(t, 0, sizeof(t));
    for (int i = 1; i <= x[0]; ++i)
    {
        for (int j = 1; j <= y[0]; ++j)
        {
            if (i + j - 1 > baselen)
                continue;
            t[i + j - 1] += x[i] * y[j];
            t[i + j] += t[i + j - 1] / 10;
            t[i + j - 1] %= 10;
            t[0] = i + j;
        }
    }
    memcpy(b, t, sizeof(b));
}
void quickPower(int p)
{
    if (p == 1)
    {
        memcpy(b, a, sizeof(b));
        return;
    }
    quickPower(p / 2);
    multiply(b, b);
    if (p % 2 == 1)
        multiply(b, a);
}
int main()
{
    cin >> p;
    cout << (int)(p * log10(2) + 1) << endl;
    a[0] = 1, a[1] = 2;
    b[0] = 1, b[1] = 1;
    quickPower(p);
    for (int i = baselen; i >= 1; --i)
    {
        if (i == 1)
            cout << b[i] - 1;
        else
            cout << b[i];
        if ((500 - i + 1) % 50 == 0)
            cout << endl;
    }
    return 0;
}